local modname = ...
local M={}
_G[modname] = M
package.loaded[modname] = M

M.system={
	params={"model"},
	get = "uci get system.device.model",
}

M.network={
	params={"ipaddr","netmask","gateway","ifname","type","proto"},
	stat = "uci get network.@interface[<num>]",
	del = "uci delete network.<section>",
	section = "uci show network.@interface[<num>] | awk -F[.=] '{print $2}'",
	new = "uci add network.<section>=interface",
	get = "uci get network.<section>.<option>",
	set = "uci set network.<section>.<option>",
	restart = "/etc/init.d/network restart"
}

M.wireless={
	params={"device","mode","network","ssid","encryption","key"},
	stat = "uci get wireless.@wifi-iface[<num>]",
	del = "uci delete wireless.<section>",
	section = "uci show wireless.@wifi-iface[<num>] | awk -F[.=] '{print $2}'",
	new = "uci set wireless.<section>=wifi-iface",
	get = "uci get wireless.<section>.<option>",
	set = "uci set wireless.<section>.<option>",
	restart = "wifi"
}

M.switch={
	params={"name","enable_vlan"},
	stat = "uci get network.@switch[<num>]",
	del = "uci delete network.<section>",
	section = "uci show network.@switch[<num>] | awk -F[.=] '{print $2}'",
	new = "uci add network.<section>=switch",
	get = "uci get network.<section>.<option>",
	set = "uci set network.<section>.<option>",
	restart = "/etc/init.d/network restart"
}

M.vlan={
	params={"device","vlan","ports"},
	stat = "uci get network.@switch_vlan[<num>]",
	del = "uci delete network.<section>",
	section = "uci show network.@switch_vlan[<num>] | awk -F[.=] '{print $2}'",
	new = "uci set network.<section>=switch_vlan",
	get = "uci get network.<section>.<option>",
	set = "uci set network.<section>.<option>",
	restart = "/etc/init.d/network restart"
}
